import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("role", { schema: "small_tail_admin" })
export class Role {
  @PrimaryGeneratedColumn({ type: "int", name: "id", comment: "主键 ID" })
  id: number;

  @Column("varchar", { name: "name", comment: "角色名称", length: 20 })
  name: string;

  @Column("varchar", { name: "code", comment: "角色编码", length: 50 })
  code: string;

  @Column("varchar", {
    name: "remark",
    nullable: true,
    comment: "备注",
    length: 255,
  })
  remark: string | null;

  @Column("int", { name: "sort", comment: "排序", default: () => "'0'" })
  sort: number;

  @Column("tinyint", {
    name: "disabled",
    comment: "是否禁用",
    width: 1,
    default: () => "'0'",
  })
  disabled: boolean;

  @Column("tinyint", {
    name: "deleted",
    comment: "是否删除",
    width: 1,
    default: () => "'0'",
  })
  deleted: boolean;

  @Column("datetime", {
    name: "create_time",
    comment: "创建时间",
    default: () => "CURRENT_TIMESTAMP",
  })
  createTime: Date;

  @Column("datetime", {
    name: "update_time",
    comment: "更新时间",
    default: () => "CURRENT_TIMESTAMP",
  })
  updateTime: Date;

  @Column("datetime", {
    name: "delete_time",
    nullable: true,
    comment: "删除时间",
  })
  deleteTime: Date | null;
}
